{include file="common/header"}
<div class="content-wrapper">
    {include file="task/nav"/}
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="nav-tabs-custom">
                    {include file="task/tabs"/}
                    <div class="tab-content">
                        <div class="tab-pane active" id="tab1">
                            <div class="page-content">
                                <div class="panel panel-info">
                                    <div class="panel-heading">筛选</div>
                                    <div class="panel-body">
                                        <form class="form-horizontal" role="form">
                                            <div class="form-group">
                                                <label class="col-xs-12 col-sm-3 col-md-2 control-label">关键词</label>
                                                <div class="col-sm-6 col-md-8 col-lg-8 col-xs-12">
                                                    <input type="text" class="form-control" name="keyword" value="" placeholder="请输入关键词,任务名称,用户id">
                                                </div>
                                            </div>
                                            <div class="form-group">
                                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">分类</label>
                                                <div class="col-sm-6 col-md-8 col-lg-8 col-xs-12">
                                                    <label class="checkbox-inline">
                                                        <input type="checkbox" name="category_id[]" {if !empty($_GET['category_id']) && in_array(0,$_GET['category_id'])}checked{/if} value="2">
                                                        简单转发
                                                    </label>
                                                    <label class="checkbox-inline">
                                                        <input type="checkbox" name="category_id[]" {if !empty($_GET['category_id']) && in_array(1,$_GET['category_id'])}checked{/if} value="3">
                                                        简单关注
                                                    </label>
                                                    <label class="checkbox-inline">
                                                        <input type="checkbox" name="category_id[]" {if !empty($_GET['category_id']) && in_array(1,$_GET['category_id'])}checked{/if} value="4">
                                                        认证绑卡
                                                    </label>
                                                    <label class="checkbox-inline">
                                                        <input type="checkbox" name="category_id[]" {if !empty($_GET['category_id']) && in_array(1,$_GET['category_id'])}checked{/if} value="6">
                                                        注册下载
                                                    </label>
                                                    <label class="checkbox-inline">
                                                        <input type="checkbox" name="category_id[]" {if !empty($_GET['category_id']) && in_array(1,$_GET['category_id'])}checked{/if} value="7">
                                                        电商相关
                                                    </label>
                                                    <label class="checkbox-inline">
                                                        <input type="checkbox" name="category_id[]" {if !empty($_GET['category_id']) && in_array(1,$_GET['category_id'])}checked{/if} value="8">
                                                        投票砍价
                                                    </label>
                                                    <label class="checkbox-inline">
                                                        <input type="checkbox" name="category_id[]" {if !empty($_GET['category_id']) && in_array(1,$_GET['category_id'])}checked{/if} value="9">
                                                        高价任务
                                                    </label>
                                                    <label class="checkbox-inline">
                                                        <input type="checkbox" name="category_id[]" {if !empty($_GET['category_id']) && in_array(1,$_GET['category_id'])}checked{/if} value="10">
                                                        多天任务
                                                    </label>
                                                    <label class="checkbox-inline">
                                                        <input type="checkbox" name="category_id[]" {if !empty($_GET['category_id']) && in_array(1,$_GET['category_id'])}checked{/if} value="11">
                                                        网页注册
                                                    </label>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-xs-12 col-sm-3 col-md-2 control-label">审核状态</label>
                                                <div class="col-sm-6 col-md-8 col-lg-8 col-xs-12">
                                                    <label class="checkbox-inline">
                                                        <input type="checkbox" name="is_display[]" {if !empty($_GET['is_display']) && in_array(0,$_GET['is_display'])}checked{/if} value="0">
                                                        待审核
                                                    </label>
                                                    <label class="checkbox-inline">
                                                        <input type="checkbox" name="is_display[]" {if !empty($_GET['is_display']) && in_array(1,$_GET['is_display'])}checked{/if} value="1">
                                                        已审核
                                                    </label>
                                                    <label class="checkbox-inline">
                                                        <input type="checkbox" name="is_display[]" {if !empty($_GET['is_display']) && in_array(-1,$_GET['is_display'])}checked{/if} value="-1">
                                                        审核未通过
                                                    </label>
                                                </div>
                                                
                                            </div>
                                            <div class="form-group">
                                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">进行状态</label>
                                                <div class="col-sm-6 col-md-8 col-lg-8 col-xs-12">
                                                    <label class="checkbox-inline">
                                                        <input type="checkbox" name="is_stop[]" {if !empty($_GET['is_stop']) && in_array(0,$_GET['is_stop'])}checked{/if} value="0">
                                                        进行中
                                                    </label>
                                                    <label class="checkbox-inline">
                                                        <input type="checkbox" name="is_stop[]" {if !empty($_GET['is_stop']) && in_array(1,$_GET['is_stop'])}checked{/if} value="1">
                                                        暂停中
                                                    </label>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">上架状态</label>
                                                <div class="col-sm-6 col-md-8 col-lg-8 col-xs-12">
                                                    <label class="checkbox-inline">
                                                        <input type="checkbox" name="out_stock_flag[]" {if !empty($_GET['out_stock_flag']) && in_array(0,$_GET['out_stock_flag'])}checked{/if} value="0">
                                                        已上架
                                                    </label>
                                                    <label class="checkbox-inline">
                                                        <input type="checkbox" name="out_stock_flag[]" {if !empty($_GET['out_stock_flag']) && in_array(1,$_GET['out_stock_flag'])}checked{/if} value="1">
                                                        已下架
                                                    </label>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                            <label class="col-xs-12 col-sm-3 col-md-2 control-label">排序</label>
                                                <div class="col-sm-6 col-md-8 col-lg-8 col-xs-12">
                                                    <label class="checkbox-inline">
                                                        <input type="checkbox" name="rank" {if !empty($_GET['rank']) && $_GET['rank'] == 'unit_price'}checked{/if} value="unit_price">
                                                        任务单价
                                                    </label>
                                                
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <div class="col-sm-6 col-md-8 col-lg-8 col-xs-12 col-md-offset-2 col-lg-offset-2 col-sm-offset-4">
                                                    <button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
                                                    <!-- <input type="hidden" name="token" value="28ab76d3">
                                                    <input class="btn btn-primary" type="submit" name="export_submit" value="导出"> -->
                                                </div>
                                            </div>
                                        </form>
                                    </div>
                                </div>
                                <form method="post" class="form-horizontal" id="display_form">
                                    <input type="hidden" name="op" value="post_category">
                                    <input type="hidden" name="ac" value="delete">
                                    <div class="panel panel-default ">
                                        <div class="table-responsive panel-body">
                                            <table class="table table-hover">
                                                <thead class="navbar-inner">
                                                <tr>
                                                    <th style="width: 45px">删?</th>
                                                    <th>编号</th>
                                                    <th>用户ID</th>
                                                    <th>发布类型</th>
                                                    <th>标题</th>
                                                    <th>应用名</th>
                                                    <th>昵称</th>
                                                    <th>上架状态</th>
                                                    <th>进行状态</th>
                                                    <th>审核状态</th>
                                                    
                                                    <th>任务单价</th>
                                                    <th>任务数量</th>
                                                    <th>任务总额</th>
                                                    <th>开始时间</th>
                                                    <th>结束时间</th>
                                                    <th>拒绝原因</th>
                                                    <th>冻结原因</th>
                                                    <th>操作</th>
                                                </tr>
                                                </thead>
                                                <tbody>
                                                {if !empty($list)}
                                                    {volist name="list" id="item"}
                                                    <tr>
                                                        <td>
                                                            <input type="checkbox" name="ids[]" value="{$item['id']}">
                                                        </td>
                                                        <td class="myid">{$item['id']}</td>
                                                        <td>{$item['uid']}</td>
                                                        <td>{$item['category']}</td>
                                                        <td><a href="/home/task/detail/id/{$item['id']}" target="_blank">{$item['title']}</a></td>
                                                        <td><a href="/admin/task/index?appName={$item.appName}">{$item.appName}</a></td>
                                                        <td>{$item.nickname}</td>
                                                         <td class="xjstatus">
                                                            {if $item['out_stock_flag'] == 0}
                                                            <label class="label label-success">已上架</label>
                                                            {else}
                                                            <label class="label label-danger">已下架</label>
                                                            {/if}
                                                        </td>
                                                        <td class="zanting">
                                                        	{if $item['is_dj'] == 0}
                                                        		<label class="label label-danger">已冻结</label>
                                                        	{else}
	                                                            {if $item['is_stop'] == 0}
	                                                            	<label class="label label-success">进行中</label>
	                                                            {else}
	                                                            	<label class="label label-danger">已暂停</label>
	                                                            {/if}
                                                            {/if}
                                                        </td>
                                                       
                                                        <td class="mystatus">
                                                            {if $item['is_display'] == 0}
                                                            <label class="label label-info">待审核</label>
                                                            {elseif $item['is_display'] == 1}
                                                            <label class="label label-success">已审核</label>
                                                            {else}
                                                            <label class="label label-danger">审核未通过</label>
                                                            {/if}
                                                        </td>
                                                        
                                                        
                                                        <td>
                                                            <label class="label label-success">{$item['unit_price']}</label>
                                                        </td>
                                                        <td>{$item['ticket_num']}</td>
                                                        <td>
                                                            <label class="label label-success">{$item['give_credit2']}</label>
                                                        </td>
                                                        <td>{$item['start_time']}</td>
                                                        <td>{$item['end_time']}</td>
                                                      
                                                        <td>
                                                            <input type="text" class="myreson" placeholder="{$item.audit_remarks}"/>
                                                        </td>
                                                        <td>
                                                            <input type="text" class="djreson" placeholder="{$item.dj_reason}"/>
                                                        </td>
                                                        <td>
                                                            <a href="{:U('post', 'id=' . $item['id'])}" class="btn btn-sm btn-success">编辑</a>
                                                            <a href="javascript:;"  class="btn btn-sm btn-success pass">通过</a>
                                                            <a href="javascript:;"  class="btn btn-sm btn-success nopass" style="background-color:#647B71;">不通过</a>
                                                            <a href="javascript:;"  class="btn btn-sm btn-warning stop" >暂停</a>
                                                            <a href="javascript:;"  class="btn btn-sm btn-success kaiqi" >开启</a>
                                                            <a href="javascript:;"  class="btn btn-sm btn-danger xiajia" >下架</a>
                                                            <a href="javascript:;"  class="btn btn-sm btn-danger dongjie" >冻结</a>
                                                        </td>
                                                    </tr>
                                                    {/volist}
                                                    <tr>
                                                        <td>
                                                            <input type="checkbox" onclick="var ck = this.checked;$('table').find(':checkbox').each(function(){this.checked = ck});">
                                                        </td>
                                                        <td colspan="6">
                                                            <button class="btn btn-sm btn-danger" name="submit" type="button">删除</button>
                                                        </td>
                                                    </tr>
                                                {/if}
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </form>
                                {$pager}
                                <script type="text/javascript">
                                    $(function () {
                                        $('button[name="submit"]').bind('click',function() {
                                            if (confirm('删除后不可恢复，您确定删除吗？')) {
                                                $.post(
                                                    window.location.href,
                                                    $('#display_form').serialize(),
                                                    function (ret) {
                                                        message(ret.message, ret.redirect, ret.type);
                                                    }, 'json'
                                                );
                                            }
                                        });
                                    });
                                </script>
                            </div>
                        </div>
                    </div>
                    <!-- /.tab-content -->
                </div>
                <!-- /.nav-tabs-custom -->
            </div>
            <!-- /.col -->
        </div>
    </section>
</div>
<script>
$('.pass').click(function(){
	var index = $('.pass').index(this);
	var id = $('.myid').eq(index).html();
	$.post(
             'pass',
             {id:id},
             function (ret) {
             	$('.mystatus').eq(index).html('<label class="label label-success">已审核</label>');
            message(ret.message, ret.redirect, ret.type);
            }, 'json'
           );
})
$('.nopass').click(function(){
	var index = $('.nopass').index(this);
	var id = $('.myid').eq(index).html();
	var reson = $('.myreson').eq(index).val();
	$.post(
             'nopass',
             {id:id,reson:reson},
             function (ret) {
             	$('.mystatus').eq(index).html('<label class="label label-danger">审核未通过</label>');
            message(ret.message, ret.redirect, ret.type);
            }, 'json'
           );
})
//暂停
$('.stop').click(function(){
	var index = $('.stop').index(this);
	var id = $('.myid').eq(index).html();
	$.post(
             'stop',
             {id:id},
             function (ret) {
             	$('.zanting').eq(index).html('<label class="label label-danger">已暂停</label>');
            message(ret.message, ret.redirect, ret.type);
            }, 'json'
           );
})
//暂停
$('.kaiqi').click(function(){
	var index = $('.kaiqi').index(this);
	var id = $('.myid').eq(index).html();
	$.post(
             'kaiqi',
             {id:id},
             function (ret) {
             	$('.zanting').eq(index).html('<label class="label label-success">进行中</label>');
            message(ret.message, ret.redirect, ret.type);
            }, 'json'
           );
})
$('.xiajia').click(function(){
	var index = $('.xiajia').index(this);
	var id = $('.myid').eq(index).html();
	$.post(
             'xiajia',
             {id:id},
             function (ret) {
             	$('.xjstatus').eq(index).html('<label class="label label-danger">已下架</label>');
            message(ret.message, ret.redirect, ret.type);
            }, 'json'
           );
})
//冻结

$('.dongjie').click(function(){
	var index = $('.dongjie').index(this);
	var id = $('.myid').eq(index).html();
	var reason = $('.djreson').eq(index).val();
	$.post(
             'dongjie',
             {id:id,reason:reason},
             function (ret) {
             	$('.zanting').eq(index).html('<label class="label label-danger">已冻结</label>');
            message(ret.message, ret.redirect, ret.type);
            }, 'json'
           );
})
</script>
{include file='common/ufooter'}
